<template>
  <!-- 产线停产 -->
  <el-dialog title="工单终止" :visible.sync="showFlag" :modal="false" width="40%">
    <div class="app-container" style="padding-top: 0px">
      <el-form
        ref="form"
        class="perForm"
        :model="form"
        :rules="rules"
        label-width="120px"
        size="medium"
      >
        <el-form-item label="终止原因" prop="finishOrderCause">
            <el-input v-model="form.finishOrderCause"   type="textarea" placeholder="请输入终止原因"  />
        </el-form-item>
        <!-- <el-form-item label="异常描述" prop="exceptionDescription">
          <el-select v-model="form.exceptionDescription" style="width: 350px;" placeholder="请选择">
            <el-option
              v-for="item in remarkList"
              :key="item.id"
              :label="item.exceptionDescription"
              :value="item.exceptionDescription"
            ></el-option>
          </el-select>
        </el-form-item> -->
      </el-form>
      <!-- <div slot="footer" class="dialog-footer">
          <el-button @click="reset" style="font-size: 24px;">重 置</el-button>
          <el-button type="primary" style="font-size: 24px;" @click="submitForm">提 交</el-button>
      </div>-->
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirmSelect">确 定</el-button>
      <el-button @click="showFlag = false">取 消</el-button>
    </div>
  </el-dialog>
</template>
      
  <script>
// reportAll
import {  finishOrder } from "@/api/mes/pro/workorder";
export default {
  name: "productReport",
  data() {
    return {
      showFlag: false,
      form: {},
      rules: {
        exceptionId: [
          { required: true, message: "异常描述不能为空", trigger: "change" }
        ],
        type: [
          { required: true, message: "终止原因不能为空", trigger: "change" }
        ]
      },
      remarkList: [],
      exceptionTypes: ["物料异常", "设备异常", "质量异常", "功能异常"]
    };
  },
  methods: {
    init(row) {
      console.log(row, "row");
      this.form = { ...row };
      this.showFlag = true;
    },
    //确定
    confirmSelect() {
      let param = {
        finishOrderCause: this.form.finishOrderCause,
        workorderId: this.form.workorderId
      };
      finishOrder(param).then(res => {
        if (res.code == 200) {
          this.showFlag = false;
          this.$message.success(res.msg);
          this.$parent.getList();
        }
      });
    }
  }
};
</script>
      <style lang="scss" scoped>
// .contentDiv {
//   width: 1350px;
// }
.el-table {
  margin-bottom: 15px;
}
</style>